void ShortestDist(LGraph Graph, int dist[], Vertex S)
{
	Vertex Q[MaxVertexNum];
	Vertex V;
	PtrToAdjVNode W;
	int front = 0, rear = 0;
	for (int i = 0; i < Graph->Nv; i++)
	{
		if (i == S)
			dist[i] = 0;
		else
			dist[i] = -1;
	}

	Q[rear++] = S;
	while (front != rear)
	{
		V = Q[front++];
		for (W = Graph->G[V].FirstEdge; W; W = W->Next)
		{
			if (dist[W->AdjV] == -1)
			{
				dist[W->AdjV] = dist[V] + 1;
				Q[rear++] = W->AdjV;
			}
		}
	}
}